﻿#include"List.h"

void test01()
{
	//初始化1
	LTNode* plist = NULL;
	LTInit1(&plist);

	//初始化2
	//LTNode* plist = LTInit();
 
	//尾插
	LTPushBack(plist, 1);
	LTPushBack(plist, 2);
	LTPushBack(plist, 3);
	LTPushBack(plist, 4);

	//头插
	/*LTPushFront(plist, 1);
	LTPushFront(plist, 2);
	LTPushFront(plist, 3);
	LTPushFront(plist, 4);*/

	//尾删
	/*LTPopBack(plist);
	LTPopBack(plist);
	LTPopBack(plist);
	LTPopBack(plist);
	LTPrint(plist);*/

	//头删
	/*LTPopFront(plist);
	LTPopFront(plist);
	LTPopFront(plist);
	LTPopFront(plist);
	LTPrint(plist);*/

	//查找
	LTNode* pos = LTFind(plist, 2);
	/*if (pos)
	{
		printf("找到了!\n");
	}
	else
	{
		printf("未找到!\n");
	}*/

	//在pos之后插入数据
	//LTInsert(pos, 416);
	//LTPrint(plist);

	//在pos之前插入数据
	LTInsertFront(pos, 416);
	LTPrint(plist);


	//删除pos位置的数据
	LTErase(pos);
	LTPrint(plist);

	//销毁1
	LTDesTroy1(&plist);

	//销毁2 -- 保持接口的一致性
	//LTDesTroy2(plsit);
	//plist = NULL;
}

int main()
{
	test01();
	return 0;
}